<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="clock" />
	<!-- <script type="text/javascript">
			var int=setInterval("clock()",1000);
			function clock(){
				var d=new Date();  
				var t=d.toLocaleTimeString();
			document.getElementById("clock").value=t;
			}
	</script>
    <button onclick="window.clearInterval(int)">停止</button> -->
    <button id="btn">开始</button>
    <script>
            const btn = document.querySelector('#btn')
            btn.addEventListener('click',function(){
            var d=new Date(); 
            let time = d.toLocaleTimeString();
            document.querySelector('#clock').value=time
        })
    </script>
    
	
</body>
</html>